Tomáš Pospíšek's Notizblock
list all installed Debian root packages and all dependencies
The following script will list all installed packages that are depended upon by other packages - prefixed with "dependency" in the listing and all packages that are not depended upon by other packages - prefixed with "root" - in the listing.
#!/bin/bash
installed_packages=$( dpkg --get-selections | sed 's/\s.*//' )
for p in $installed_packages; do
dependents=$( apt-rdepends --state-follow=Installed --state-show=Installed -r $p 2>/dev/null )
if [ "$p" == "$dependents" ]; then
echo "root $p"
else
echo "dependency $p"
fi
done
Tomáš Pospíšek, 2014-08-18